/*
 * Powered By [cciot base platform]
 * Web Site: http://www.cciot.net
 * Since 2012 - 2013
 */

package net.cciot.platform.core.model;

import javax.validation.constraints.*;
import org.hibernate.validator.constraints.*;
import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;

import java.io.*;
import java.net.*;
import java.util.*;

import java.math.BigDecimal;
import java.math.BigInteger;

import net.cciot.platform.common.base.*;

import static net.cciot.platform.common.util.DateFormats.*;
import static net.cciot.platform.common.util.GlobalMessages.*;
import static net.cciot.platform.common.util.SpringMVCUtils.toModelMap;
import static net.cciot.platform.common.util.MybatisPageQueryUtils.pageQuery;

import static cn.org.rapid_framework.util.ValidationErrorsUtils.convert;
import static cn.org.rapid_framework.beanutils.BeanUtils.copyProperties;
import static cn.org.rapid_framework.util.holder.BeanValidatorHolder.validateWithException;
import cn.org.rapid_framework.util.DateConvertUtils;

import cn.org.rapid_framework.page.PageRequest;
import cn.org.rapid_framework.page.Page;

import net.cciot.platform.core.model.*;
import net.cciot.platform.core.dao.*;
import net.cciot.platform.core.service.*;
import net.cciot.platform.core.query.*;


/**
 * @author anduo email:anduo1989@gmail.com
 * @version 1.0
 * @since 1.0
 */
public class BaseUsers  implements java.io.Serializable{
	private static final long serialVersionUID = 5454155825314635342L;
	
	//alias
	public static final String TABLE_ALIAS = "BaseUsers";
	public static final String ALIAS_USER_ID = "userId";
	public static final String ALIAS_ACCOUNT = "account";
	public static final String ALIAS_PASSWORD = "password";
	public static final String ALIAS_REAL_NAME = "realName";
	public static final String ALIAS_SEX = "sex";
	public static final String ALIAS_EMAIL = "email";
	public static final String ALIAS_MOBILE = "mobile";
	public static final String ALIAS_OFFICE_PHONE = "officePhone";
	public static final String ALIAS_ERROR_COUNT = "errorCount";
	public static final String ALIAS_LAST_LOGIN_TIME = "lastLoginTime";
	public static final String ALIAS_LAST_LOGIN_IP = "lastLoginIp";
	public static final String ALIAS_REMARK = "remark";
	
	//date formats
	public static final String FORMAT_LAST_LOGIN_TIME = DATE_FORMAT;
	
	//可以直接使用: @Length(max=50,message="用户名长度不能大于50")显示错误消息
	//columns START
    /**
     * userId       db_column: USER_ID 
     */	
	@Length(max=32)
	private java.lang.String userId;
    /**
     * account       db_column: ACCOUNT 
     */	
	@Length(max=64)
	private java.lang.String account;
    /**
     * password       db_column: PASSWORD 
     */	
	@Length(max=128)
	private java.lang.String password;
    /**
     * realName       db_column: REAL_NAME 
     */	
	@Length(max=64)
	private java.lang.String realName;
    /**
     * sex       db_column: SEX 
     */	
	
	private java.lang.Boolean sex;
    /**
     * email       db_column: EMAIL 
     */	
	@Length(max=64)
	private java.lang.String email;
    /**
     * mobile       db_column: MOBILE 
     */	
	@Length(max=32)
	private java.lang.String mobile;
    /**
     * officePhone       db_column: OFFICE_PHONE 
     */	
	@Length(max=32)
	private java.lang.String officePhone;
    /**
     * errorCount       db_column: ERROR_COUNT 
     */	
	@Max(127)
	private Integer errorCount;
    /**
     * lastLoginTime       db_column: LAST_LOGIN_TIME 
     */	
	
	private java.util.Date lastLoginTime;
    /**
     * lastLoginIp       db_column: LAST_LOGIN_IP 
     */	
	@Length(max=32)
	private java.lang.String lastLoginIp;
    /**
     * remark       db_column: REMARK 
     */	
	@Length(max=128)
	private java.lang.String remark;
	//columns END

	public BaseUsers(){
	}

	public BaseUsers(
		java.lang.String userId
	){
		this.userId = userId;
	}

	public void setUserId(java.lang.String value) {
		this.userId = value;
	}
	
	public java.lang.String getUserId() {
		return this.userId;
	}
	public void setAccount(java.lang.String value) {
		this.account = value;
	}
	
	public java.lang.String getAccount() {
		return this.account;
	}
	public void setPassword(java.lang.String value) {
		this.password = value;
	}
	
	public java.lang.String getPassword() {
		return this.password;
	}
	public void setRealName(java.lang.String value) {
		this.realName = value;
	}
	
	public java.lang.String getRealName() {
		return this.realName;
	}
	public void setSex(java.lang.Boolean value) {
		this.sex = value;
	}
	
	public java.lang.Boolean getSex() {
		return this.sex;
	}
	public void setEmail(java.lang.String value) {
		this.email = value;
	}
	
	public java.lang.String getEmail() {
		return this.email;
	}
	public void setMobile(java.lang.String value) {
		this.mobile = value;
	}
	
	public java.lang.String getMobile() {
		return this.mobile;
	}
	public void setOfficePhone(java.lang.String value) {
		this.officePhone = value;
	}
	
	public java.lang.String getOfficePhone() {
		return this.officePhone;
	}
	public void setErrorCount(Integer value) {
		this.errorCount = value;
	}
	
	public Integer getErrorCount() {
		return this.errorCount;
	}
	public String getLastLoginTimeString() {
		return DateConvertUtils.format(getLastLoginTime(), FORMAT_LAST_LOGIN_TIME);
	}
	public void setLastLoginTimeString(String value) {
		setLastLoginTime(DateConvertUtils.parse(value, FORMAT_LAST_LOGIN_TIME,java.util.Date.class));
	}
	
	public void setLastLoginTime(java.util.Date value) {
		this.lastLoginTime = value;
	}
	
	public java.util.Date getLastLoginTime() {
		return this.lastLoginTime;
	}
	public void setLastLoginIp(java.lang.String value) {
		this.lastLoginIp = value;
	}
	
	public java.lang.String getLastLoginIp() {
		return this.lastLoginIp;
	}
	public void setRemark(java.lang.String value) {
		this.remark = value;
	}
	
	public java.lang.String getRemark() {
		return this.remark;
	}

	public String toString() {
		return ToStringBuilder.reflectionToString(this);
	}
	
	public int hashCode() {
		return new HashCodeBuilder()
			.append(getUserId())
			.toHashCode();
	}
	
	public boolean equals(Object obj) {
		if(obj instanceof BaseUsers == false) return false;
		if(this == obj) return true;
		BaseUsers other = (BaseUsers)obj;
		return new EqualsBuilder()
			.append(getUserId(),other.getUserId())
			.isEquals();
	}
}

